{include file='header.html'}
<script type="text/javascript" src="{$common_domain}/tools/datepicker/jquery-1.7.2.js"></script>
<link type="text/css" href="../../page/css/applydetail.css" rev="stylesheet" rel="stylesheet">
<div class="main">
  <div class="pr">
      <span>{$data_user.name}</span>
      <span>{$data_user.code}</span>
  </div>
  <div class="pl">
  <form name="xx" method="post" action="" >
      <ul class="u1">
          <li>
              <b>类别：</b>
              <em>{$data_leave.work_status.day_type}{$data_leave.type}</em>
              {if $user_all_annual}
                  <span style="" id="tach" class="tach">
                    <span class="ic"></span>
                    <span id="tach_text">该员工还有{$user_all_annual.left}天年假，至{$njyear}年12月31日将有{$user_all_annual.need_do}天过期</span>
                        <span class="ico">
                          <a title="查看帮助文档" target="_blank" href="/help/"> </a>
                        </span>
                  </span>
              {/if}
          </li>
          <li>
              <b>{if $data_leave.type=='公出'}公出时间{elseif $data_leave.type=='出差'}出差时间{else} 日期：{/if}</b>
              {if $data_leave.type=='迟到' || $data_leave.type=='早退' || $data_leave.type=='缺勤'}
                <em>{$data_leave.access_date}</em>
              {else}
              <em>{$data_leave.start_time}</em><b> 至 </b><em>{$data_leave.end_time}</em>
              {/if}
          </li>
          {if $data_leave.type=='迟到' || $data_leave.type=='早退' || $data_leave.type=='缺勤'}
          <li>
              <b>打卡时间：</b>
                {if $data_leave.type!='早退'}
                <em>{$data_leave.work_status.start_work}</em>
                {/if}
                {if $data_leave.type=='缺勤'} {if $data_leave.work_status.start_work&&$data_leave.work_status.end_work}&nbsp;至&nbsp;{else}无打卡记录 {/if}{/if}
                {if  $data_leave.type=='早退' || $data_leave.type=='缺勤'}
                <em>{$data_leave.work_status.end_work}</em>
                {/if}
          </li>
              {if $data_leave.type=='缺勤'}
              <li>
                  <b>天数：</b>
                  <em>{$data_leave.work_status.day}</em>
              </li>
              {/if}
          <li>
              <b>原因：</b>
              <em>{$data_leave.leave_reason}</em>
          </li>
          {/if}

          {if $data_leave.type=='公出'}
          <li>
              <b>时长：</b>
              <em>{$data_leave.leave_time} 小时</em>
          </li>
          {elseif $data_leave.leave_time}
          <li>
              <b>天数：</b>
              <em>{$data_leave.leave_time} 天</em>
          </li>
          {/if}

          {if $data_leave.type=='出差'}
          <li>
              <b>出差事由：</b>
              <em>{$data_leave.leave_reason}</em>
          </li>
          {/if}


          <li>
              <b>Note:</b>
              <span class="sp1">{$data_leave.leave_desc}
              </span>
          </li>
          {if $is_agent}
          <li>
              <b>工作代理人：</b>
              <em>{$data_leave.leave_agent}</em>
          </li>
          {/if}

          {if $admin_msg.first.status}
          <li>
              <b>{$admin_msg.first.level}主管留言{if $admin_msg.first.status}({$admin_msg.first.status}){/if}：</b><br>
              <span class="sp1"><label>{if $admin_msg.first.msg}{$admin_msg.first.msg}{else}无{/if}</label></span>
          </li>
          {elseif $admin_msg.first.as}
              {if $data_leave.leave_reason!='地铁故障'}
		          <li>
		              <b>主管留言：</b>
		              <textarea rows="3" cols="100" name="apply_msg"></textarea>
		          </li>
		      {/if}
          {/if}

          {if $admin_msg.second.status}
          <li>
              <b>{$admin_msg.second.level}主管留言{if $admin_msg.second.status}({$admin_msg.second.status}){/if}：</b><br>
              <span class="sp1"><label>{if $admin_msg.second.msg}{$admin_msg.second.msg}{else}无{/if}</label></span>
          </li>
          {elseif  $admin_msg.second.as}
          <li>
              <b>主管留言：</b>
              <textarea rows="3" cols="100" name="apply_msg"></textarea>
          </li>
          {/if}

          <li>
          {if $data_leave.status eq '未审核'}
              {if ($admin_msg.second.as AND !$admin_msg.second.status)or ($admin_msg.first.as AND !$admin_msg.first.status)}
                  <input class="lgo" type="submit" name="apply" value="批 准">
                  <input class="lgo" type="submit" name="apply1" value="驳 回">
              {else}
                <a class="lgo" type="submit" href="{$unaudit_url}">返 回</a>
              {/if}
          {else}
               <a class="lgo" type="submit" href="{$unaudit_url}">返 回</a>
               {if $data_leave.type=='出差'}
               <a class="lgo" type="submit" href="{$print_url}" target="_blank">打印预览</a>
               {/if}
          {/if}

          </li>
          <!--图片灰色显示-->
          <!--图片蓝色显示-->
           {if $data_leave.img}
           <div class="li1">
                 <a class="sp3" href="#" onclick="showBg('{$data_leave.img}')"></a>
            </div>
           {else}
           <div class="li1">
              <a class="sp2" href="#"></a>
          </div>
           {/if}

</form>
       </ul>
  </div>

    {if $show_special}
    <span class="sp9"><b>请假历史</b>(近三个月)</span>
    <table class="u2" cellpadding="0" cellspacing="0" border="0">
        <tr class="fir">
            <td class="">申请类型</td>
            <td class="">申请时间</td>
            <td class="">天数</td>
            <td class="">原因</td>
            <td class="">批准状态</td>
        </tr>
        {foreach from=$data_record item=list}
        <tr>
            <td class="i21">{$list.type}&nbsp;</td>
            <td class="i41">
              {if $list.type=='迟到' || $list.type=='早退' || $list.type=='缺勤'}
               {$list.access_date}&nbsp;
                {if $list.type!='早退'}
                    {$list.work_status.start_work}
                {/if}

                {if $list.type=='缺勤'} {if $list.work_status.start_work&&$list.work_status.end_work}&nbsp;至&nbsp;{/if} {/if}

                {if  $list.type=='早退' || $list.type=='缺勤'}
                    {if $list.type!='早退'&&$list.work_status.end_work}{$list.access_date}&nbsp; {/if}{$list.work_status.end_work}
                {/if}
              {else}
              {$list.start_time}&nbsp;{if $list.start_time&&$list.end_time}至{/if}&nbsp;{$list.end_time}
              {/if}

            </td>
            <td class="i31">{if $list.type eq '早退'||$list.type eq '缺勤'||$list.type eq '迟到'}{$list.work_status.day}{else}{if $list.type eq '公出'}{$list.leave_time}  (小时){else}{$list.leave_time}{/if}{/if}&nbsp;</td>
            <td class="i51">{$list.leave_reason} - {$list.leave_desc}&nbsp;</td>
            <td class="i61">{$list.status}&nbsp;</td>
        </tr>
        {/foreach}
    </table>
    {/if}

     <!-- jQuery 遮罩层 -->
     <div id="fullbg"></div>
     <!-- end jQuery 遮罩层 -->
     <!-- 对话框 -->
     <div id="dialog">
          <p></p>
          <a href="#" onclick="closeBg();" class="close"></a>
    </div>
</div>

<script type="text/javascript">
    //显示灰色 jQuery 遮罩层
    function showBg(src) {
        var img =  new Image();
        if (!(window.attachEvent && navigator.userAgent.indexOf('Opera') === -1)) {
            img.onload = function(){
                showPic(img.width,img.height,img);
            }
        }
        else {
            img.onreadystatechange = function(){
                if ('loaded' === img.readyState || 'complete' === img.readyState) {
                    showPic(img.width,img.height,img);
                }
            }
        }
        img.src = src;

    }

    function showPic(w,h,src) {
        var wnd = $(window), doc = $(document), b = 1, offset = 20;;
        var bh = $("body").height();
        var bw = $("body").width();
        $("#fullbg").css({
            height:bh,
            width:bw,
            display:"block"
        });

        if(wnd.height()-offset < h){
            b = (wnd.height()-offset) / h;
        }
        w = parseInt(w * b, 10);
        h = parseInt(h * b, 10);

        $('#dialog p').first().html(src);
        $("#dialog").show();
        var close=$(".close").width();
        var left = doc.scrollLeft();
        var top = doc.scrollTop();
        left += (wnd.width() - w)/2;
        top += (wnd.height() - h)/2;
        $("#dialog").css("position","absolute");
        $("#dialog").css("top",top);
        $("#dialog").css("width",w);
        $("#dialog").css("height",h);
        $("#dialog").css("left",left);
        $("#dialog img").css("width",w);
        $("#dialog img").css("height",h);
//      $(".close").css("top",top);
        $(".close").css("left",(w-close));
    }
    //关闭灰色 jQuery 遮罩
    function closeBg() {
        $("#fullbg,#dialog").hide();
    }
</script>